<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>系统设置 - AI智能教学培训系统</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }

        :root {
            --primary: #4361ee;
            --secondary: #3f37c9;
            --accent: #4895ef;
            --light: #f8f9fa;
            --dark: #212529;
            --success: #4cc9f0;
            --warning: #f72585;
            --gray: #6c757d;
        }

        body {
            background-color: #f5f7fb;
            color: var(--dark);
        }

        .app-container {
            display: flex;
            min-height: 100vh;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 260px;
            background: linear-gradient(180deg, var(--primary), var(--secondary));
            color: white;
            box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
            transition: all 0.3s;
            position: fixed;
            height: 100vh;
            overflow-y: auto;
        }

        .logo-container {
            padding: 20px;
            text-align: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .logo {
            font-size: 24px;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-icon {
            margin-right: 10px;
            font-size: 28px;
        }

        .nav-menu {
            padding: 20px 0;
        }

        .nav-item {
            padding: 12px 25px;
            display: flex;
            align-items: center;
            cursor: pointer;
            transition: all 0.3s;
            border-left: 4px solid transparent;
        }

        .nav-item:hover {
            background: rgba(255, 255, 255, 0.1);
            border-left: 4px solid var(--accent);
        }

        .nav-item.active {
            background: rgba(255, 255, 255, 0.1);
            border-left: 4px solid var(--accent);
        }

        /* 侧边栏链接无下划线且不变色 */
        a.nav-item {
            text-decoration: none;
            color: inherit;
        }
        a.nav-item:visited,
        a.nav-item:active,
        a.nav-item:focus {
            color: inherit;
        }

        .nav-icon {
            margin-right: 12px;
            font-size: 18px;
        }

        /* 主内容区 */
        .main-content {
            flex: 1;
            margin-left: 260px;
            padding: 30px;
            transition: all 0.3s;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
        }

        .page-title {
            font-size: 28px;
            font-weight: 600;
            color: var(--dark);
        }

        .user-info {
            display: flex;
            align-items: center;
        }

        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            margin-right: 10px;
        }

        /* 设置页面特定样式 */
        .settings-container {
            display: flex;
            gap: 20px;
        }

        .settings-sidebar {
            width: 220px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            padding: 20px 0;
        }

        .settings-menu-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            border-left: 4px solid transparent;
        }

        .settings-menu-item:hover {
            background: #f8f9fa;
        }

        .settings-menu-item.active {
            background: rgba(67, 97, 238, 0.1);
            border-left: 4px solid var(--primary);
            color: var(--primary);
        }

        .settings-menu-icon {
            margin-right: 10px;
            font-size: 16px;
        }

        .settings-content {
            flex: 1;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            padding: 30px;
        }

        .settings-section {
            margin-bottom: 40px;
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 25px;
            position: relative;
            padding-left: 15px;
        }

        .section-title:before {
            content: '';
            position: absolute;
            left: 0;
            top: 5px;
            height: 20px;
            width: 5px;
            background: var(--primary);
            border-radius: 3px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
        }

        .avatar-upload {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
        }

        .avatar-preview {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: #f8f9fa;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 20px;
            overflow: hidden;
            border: 1px solid #eee;
        }

        .avatar-preview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .notification-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 0;
            border-bottom: 1px solid #eee;
        }

        .notification-label {
            font-weight: 500;
        }

        .notification-desc {
            color: var(--gray);
            font-size: 14px;
            margin-top: 5px;
        }

        .security-item {
            padding: 15px 0;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .security-info {
            display: flex;
            align-items: center;
        }

        .security-icon {
            margin-right: 10px;
            font-size: 20px;
        }

        .security-icon.success {
            color: var(--success);
        }

        .security-icon.warning {
            color: var(--warning);
        }

        .security-status {
            font-size: 14px;
            margin-top: 5px;
        }

        .security-status.success {
            color: var(--success);
        }

        .security-status.warning {
            color: var(--warning);
        }

        .preference-item {
            padding: 15px 0;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .save-btn {
            background: var(--primary);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s;
            font-size: 16px;
        }

        .save-btn:hover {
            background: var(--secondary);
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .sidebar {
                width: 70px;
            }

            .logo-text, .nav-text {
                display: none;
            }

            .logo-icon {
                margin-right: 0;
            }

            .nav-item {
                justify-content: center;
            }

            .nav-icon {
                margin-right: 0;
            }

            .main-content {
                margin-left: 70px;
            }

            .settings-container {
                flex-direction: column;
            }

            .settings-sidebar {
                width: 100%;
                display: flex;
                overflow-x: auto;
                padding: 0;
            }

            .settings-menu-item {
                white-space: nowrap;
                border-left: none;
                border-bottom: 3px solid transparent;
            }

            .settings-menu-item.active {
                border-left: none;
                border-bottom: 3px solid var(--primary);
            }
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .fade-in {
            animation: fadeIn 0.5s ease forwards;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="app-container">
        <!-- 侧边导航 -->
        <div id="sidebar"></div>

        <!-- 主内容区 -->
        <div class="main-content">
            <!-- 顶部导航 -->
            <div class="header">
                <h1 class="page-title">系统设置</h1>
                <div class="user-info">
                    <div class="avatar">张</div>
                    <div>
                        <div class="user-name">张明</div>
                        <div class="user-role">学生</div>
                    </div>
                </div>
            </div>

            <!-- 设置主区域 -->
            <div class="settings-container">
                <!-- 设置侧边栏 -->
                <div class="settings-sidebar fade-in">
                    <div
                            class="settings-menu-item"
                            :class="{active: activeTab === 'profile'}"
                            @click="activeTab = 'profile'">
                        <i class="el-icon-user settings-menu-icon"></i>
                        个人资料
                    </div>
                </div>

                <!-- 设置内容区 -->
                <div class="settings-content fade-in">
                    <!-- 个人资料 -->
                    <div v-if="activeTab === 'profile'">
                        <div class="settings-section">
                            <h2 class="section-title">基本信息</h2>

                            <div class="form-group">
                                <label class="form-label">姓名</label>
                                <el-input v-model="profile.name" placeholder="请输入您的姓名"></el-input>
                            </div>

                            <div class="form-group">
                                <label class="form-label">学号</label>
                                <el-input v-model="profile.studentId" placeholder="请输入学号" disabled></el-input>
                            </div>

                            <div class="form-group">
                                <label class="form-label">电子邮箱</label>
                                <el-input v-model="profile.email" placeholder="请输入电子邮箱"></el-input>
                            </div>

                            <div class="form-group">
                                <label class="form-label">联系电话</label>
                                <el-input v-model="profile.phone" placeholder="请输入联系电话"></el-input>
                            </div>

                            <div class="form-group">
                                <label class="form-label">个人简介</label>
                                <el-input
                                        type="textarea"
                                        v-model="profile.bio"
                                        placeholder="介绍一下你自己"
                                        :rows="4">
                                </el-input>
                            </div>
                        </div>

                        <el-button type="primary" class="save-btn">保存更改</el-button>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script>
    new Vue({
        el: '#app',
        data: {
            activeTab: 'profile',
            profile: {
                name: '张明',
                studentId: '20231001',
                email: 'zhangming@example.com',
                phone: '13800138000',
                bio: '计算机科学专业学生，对算法和机器学习感兴趣'
            },
            notifications: {
                course: true,
                system: true,
                activity: true,
                message: true,
                inApp: true,
                email: true,
                sms: false
            },
            privacy: {
                publicProfile: true,
                showProgress: true,
                allowMessages: true,
                searchVisible: false,
                dataAnalysis: true,
                personalizedRecommend: true
            },
            security: {
                email: 'zhangming@example.com',
                phone: '138****8000',
                lastPasswordChange: '3个月前',
                twoFactorAuth: false,
                devices: [
                    'Windows Chrome (2023-10-15)',
                    'iPhone Safari (2023-10-10)'
                ]
            },
            preference: {
                theme: 'blue',
                fontSize: 'medium',
                darkMode: false,
                defaultView: 'video',
                playbackSpeed: '1',
                autoPlay: true
            }
        },
        mounted() {
            fetch('/user/profile', {
                headers: {
                    Authorization: 'Bearer ' + localStorage.getItem('token')
                }
            })
            .then(res => res.json())
            .then(resp => {
                if (resp.success && resp.data) {
                    this.profile = resp.data;
                    this.security.email = resp.data.email;
                } else {
                    console.error('获取用户信息失败:', resp.message);
                }
            })
            .catch(error => {
                console.error('请求用户信息出错:', error);
            });
        },
        methods: {
            changePassword() {
                this.$prompt('请输入新密码', '修改密码', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    inputPattern: /^.{6,}$/,
                    inputErrorMessage: '密码长度至少为6位'
                }).then(({ value }) => {
                    this.$message({
                        type: 'success',
                        message: '密码修改成功'
                    });
                    this.security.lastPasswordChange = '刚刚';
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消修改'
                    });
                });
            }
        }
    });
</script>
<script>
  fetch('sidebar.html').then(r=>r.text()).then(html=>{document.getElementById('sidebar').innerHTML=html;});
</script>
</body>
</html>